#include "GUIWindowManager.h"

namespace YGUI
{
    template<>
    WindowManager* Singleton<WindowManager>::m_singleton = 0;

    WindowManager::WindowManager(void)
    {
    }

    WindowManager::~WindowManager(void)
    {
    }

    WindowManager& WindowManager::getSingleton(void)
    {
        static WindowManager instance;
        return (*m_singleton);
    }

    WindowManager* WindowManager::getSingletonPtr(void)
    {
        if(!m_singleton)
            getSingleton();
        return m_singleton;
    }

    bool WindowManager::isWindowExists(const std::string& name) const
    {
        return (m_windwRegistry.find(name) != m_windwRegistry.end());
    }

    Window* WindowManager::getWindow(const std::string& name) const
    {
        WindowMap::const_iterator it = m_windwRegistry.find(name);
        if(it == m_windwRegistry.end())
            return 0;
        return it->second;
    }
};